package com.springboot.service.impl;

import com.springboot.mapper.AssistantListFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.AssistantListFormKey;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorViewAssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 医生查看助理列表
 */
@Service
public class DoctorViewAssistantServiceImpl implements DoctorViewAssistantService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;

    @Autowired
    private AssistantListFormMapper assistantListFormMapper;

    //通过手机查找用户
    @Override
    public UserLoginForm findUserByTel(String tel)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByTel(tel);
        return userLoginForm;
    }

    //通过医生id查找负责他的助理列表
    @Override
    public ArrayList<AssistantListFormKey> findAssistantByDoctor(Integer doctorId)
    {
        ArrayList<AssistantListFormKey> assistantListFormKeys=assistantListFormMapper.findAssistantById(doctorId);
        return assistantListFormKeys;
    }

    //通过用户id查找用户
    @Override
    public UserLoginForm findUserById(Integer userId)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByPrimaryKey(userId);
        return userLoginForm;
    }
}
